from PyQt5.Qt import *

class MyQWidget(QWidget):
    def __init__(self):
        super().__init__()
        self.setup_ui()

    def setup_ui(self):
        self.setWindowTitle("窗口风格")

        """
        1.窗口风格
        QStyleFactory.keys(): 获取平台支持的QStyle样式
        """
        # ['windowsvista', 'Windows', 'Fusion']
        print(QStyleFactory.keys())
        # 设置窗体风格， 貌似没有什么效果
        QApplication.setStyle(QStyleFactory.create("Windows"))


        """
        2.窗口样式
        Qt.MSWindowsFixedSizeDialogHint: 窗口无法调整大小
        Qt.FramelessWindowHint: 无边框
        Qt.CustomizeWindowHint: 有边框但是无标题栏和按钮，不能移动和拖动
        Qt.WindowTitleHint: 添加标题栏和一个关闭按钮
        Qt.WindowTitleHint: 添加系统目录和一个关闭按钮
        Qt.WindowMaximizeButtonHint: 激活最大化和关闭按钮, 禁止最小化按钮
        Qt.WindowMinimizeButtonHint: 激活最小化和关闭按钮, 禁止最大化按钮
        Qt.WindowMinMaxButtonsHint: 激活最小化、最大化和关闭
        Qt.WindowCloseButtonHint: 一个关闭按钮
        Qt.WindowContextHelpButtonHint: 问号和关闭按钮
        Qt.WindowStaysOnTopHint: 窗口时钟处于顶层位置
        Qt.WindowStaysOnBottomHint: 窗口时钟处于底层位置
        """
        #self.setWindowFlags(Qt.MSWindowsFixedSizeDialogHint)
        #self.setWindowFlags(Qt.FramelessWindowHint)
        #self.setWindowFlags(Qt.CustomizeWindowHint)
        #self.setWindowFlags(Qt.WindowTitleHint)
        #self.setWindowFlags(Qt.WindowTitleHint)
        #self.setWindowFlags(Qt.WindowMaximizeButtonHint)
        #self.setWindowFlags(Qt.WindowMinimizeButtonHint)
        #self.setWindowFlags(Qt.WindowMinMaxButtonsHint)
        #self.setWindowFlags(Qt.WindowCloseButtonHint)
        #self.setWindowFlags(Qt.WindowContextHelpButtonHint)
        #self.setWindowFlags(Qt.WindowStaysOnTopHint)
        #self.setWindowFlags(Qt.WindowStaysOnBottomHint)


        """
        3.获取屏幕尺寸
        """
        desktop = QApplication.desktop()
        rect = desktop.availableGeometry()
        print(rect)
        self.setGeometry(rect)
        self.setStyleSheet("""
            background-color: blue;
        """)

# 测试
if __name__ == '__main__':
    import sys


    app = QApplication(sys.argv)
    window = MyQWidget()
    window.show()
    sys.exit(app.exec_())